package com.realone.packman.codec.encoder;

import com.realone.packman.codec.encoder.vo.BmsEncoderDataVo06;

import java.nio.ByteBuffer;

/**
 *
 * 设置BMS放电参数 编码
 * @author hugx
 * @create 2018-09-14 14:36
 */
public class BmsEncoder06 extends BmsEncoder<BmsEncoderDataVo06> {

    @Override
    protected byte[] encoderData(BmsEncoderDataVo06 bmsEncoderDataVo06) {
        ByteBuffer bb=ByteBuffer.allocate(10);
        bb.putShort((short) (bmsEncoderDataVo06.getUnderVoltage() * 1000));
        bb.putShort((short) (bmsEncoderDataVo06.getUnderVoltageRestore() * 1000));
        bb.putShort((short) (bmsEncoderDataVo06.getDischargeOverCurrent() * 10));
        bb.putShort((short) (bmsEncoderDataVo06.getDischargeShortCurrent() * 10));
        bb.put(bmsEncoderDataVo06.getDischargeHighTemperature());
        bb.put(bmsEncoderDataVo06.getDischargeLowTemperature());
        return bb.array();
    }
}
